
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:massagist/manager/file_manager.dart';
import 'package:massagist/views/path_item.dart';

import '../generated/l10n.dart';
import '../manager/config.dart';
import '../models/path_model_entity.dart';

class PathPage extends StatefulWidget {
  @override
  State<PathPage> createState() => PathPageState();
}

class PathPageState extends State<PathPage> {
  List<PathModelEntity> paths = [];
  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    readValues();
  }

  Future<void> readValues() async {
    paths = await FileManager.readPaths();
    setState(() {

    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        color: Color(0xFFCEEFF2),
        child: Stack(
          children: [
            Container(
              width: double.infinity,
              child: Image.asset( 'assets/images/path_head.png', fit: BoxFit.fitWidth, ),
            ),

            Container(
              margin: EdgeInsets.only(top: 100.sp, left: 16.sp, right: 16.sp),
              child: SingleChildScrollView(
                child: Column(
                  children: paths.map((element) {
                    return PathItem(model: element,);
                  }).toList(),
                ),
              ),
            ),

            Container(
              padding: EdgeInsets.only(bottom: 10.sp),
              height: 88.sp,
              alignment: Alignment.bottomCenter,
              child: Text(S.current.TAB_PATH_TEXT, style: NaviTitleStyle,),
            ),
          ],
        ),
      ),
    );
  }
}